﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using LeoShi.Soft.OpenSinaAPI;


namespace TCS.Web.MembersHome
{
    public partial class publish1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 发布博文
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            var httpRequest = HttpRequestFactory.CreateHttpRequest(Method.POST);
            httpRequest.Token = Session["oauth_token"].ToString();
            httpRequest.TokenSecret = Session["oauth_token_secret"].ToString();
            httpRequest.UserRemoteIP = Request.UserHostAddress;
            var url = "http://api.t.sina.com.cn/statuses/update.xml?";
            httpRequest.Request(url, "status=" + HttpUtility.UrlEncode(txtText.Value));
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('发布成功！');location.href='publish.aspx';</script>");
        }
    }
}
